using ASP;
using HoWave.Common;
using HoWave.Web;
using HoWave.Web.Shop.Member;
using System;
using System.Collections;
using System.Data;
using System.Web.Profile;
using System.Web.SessionState;
using System.Web.UI.WebControls;
public class Shop_Member_Shop_ManageOrder : Member, IRequiresSessionState
{
	protected Literal ltrProType;
	protected DropDownList DroPayStatic;
	protected DropDownList DropDeliverStatus;
	protected DropDownList DroOrderStatic;
	protected TextBox TxtOrderNum;
	protected TextBox TxtBeginDate;
	protected TextBox TxtEndDate;
	protected TextBox TxtCusName;
	protected TextBox TxtBeginMoney;
	protected TextBox TxtEndMoney;
	protected TextBox TxtProductName;
	protected Button QuickSearchButton;
	protected DropDownList DropMoment;
	protected Repeater rptOrderInfo;
	protected Literal ltrPagePanel;
	public int UserID = 0;
	public string UserName = Language.Get("PassPort/NoUserName");
	private string wherestr = "";
	private ArrayList al = new ArrayList();
	private IDbDataParameter[] param = null;
	private string beforeurl = "Shop_ManageOrder.aspx?1=1";
	private string linkHead = "";
	private string proTypeWhere = "";
	protected DefaultProfile Profile
	{
		get
		{
			return (DefaultProfile)this.Context.Profile;
		}
	}
	protected global_asax ApplicationInstance
	{
		get
		{
			return (global_asax)this.Context.ApplicationInstance;
		}
	}
	public string ProTypeWhere
	{
		get
		{
			if (!string.IsNullOrEmpty(base.ShowProType))
			{
				string showProType = base.ShowProType;
				if (showProType != null)
				{
					if (showProType == "1")
					{
						this.ltrProType.Text = Language.Get("Shop/Product/ProductType1") + "——";
						goto IL_14A;
					}
					if (showProType == "2")
					{
						this.ltrProType.Text = Language.Get("Shop/Product/ProductType2") + "——";
						goto IL_14A;
					}
					if (showProType == "3")
					{
						this.ltrProType.Text = Language.Get("Shop/Product/ProductType3") + "——";
						goto IL_14A;
					}
					if (showProType == "4")
					{
						this.ltrProType.Text = Language.Get("Shop/Product/ProductType4") + "——";
						goto IL_14A;
					}
					if (showProType == "5")
					{
						this.ltrProType.Text = Language.Get("Shop/Product/ProductType5") + "——";
						this.proTypeWhere = " and O.TradeType=5 ";
						goto IL_14A;
					}
				}
				this.proTypeWhere = " and O.TradeType<>5 ";
				IL_14A:;
			}
			else
			{
				this.proTypeWhere = " and O.TradeType<>5 ";
			}
			return this.proTypeWhere;
		}
	}
	protected void Page_Load(object sender, EventArgs e)
	{
		this.UserID = base.user.UserID;
		this.TxtBeginDate.Attributes.Add("onclick", "SelectDate(" + this.TxtBeginDate.UniqueID + ",'yyyy-MM-dd');");
		this.TxtEndDate.Attributes.Add("onclick", "SelectDate(" + this.TxtEndDate.UniqueID + ",'yyyy-MM-dd');");
		if (!base.IsPostBack)
		{
			if (base.ShowProType == "5")
			{
				if (!base.OwnerPromotionPower(base.user.UserID))
				{
					base.WriteRightErrMsg();
				}
			}
			this.BindList();
		}
	}
	protected void BindList()
	{
		this.QuestString();
		if (this.al.Count > 0)
		{
			this.param = new IDbDataParameter[this.al.Count];
			this.al.CopyTo(this.param, 0);
		}
		Shop_Order shop_Order = new Shop_Order(this.conn);
		DataTable dataTable;
		if (this.param == null)
		{
			dataTable = this.conn.GetDataTable(string.Concat(new object[]
			{
				"Select O.*,I.* From [HLShop_Order] O Inner Join [HLShop_OrderItem] I On I.OrderFormID=O.OrderFormID Where O.SalerID=",
				this.UserID,
				" and I.ID in(select max(ID) from HLShop_OrderItem Group by OrderFormID) ",
				this.wherestr,
				" Order By O.OrderFormID Desc"
			}));
		}
		else
		{
			dataTable = this.conn.GetDataTable(string.Concat(new object[]
			{
				"Select O.*,I.* From [HLShop_Order] O Inner Join [HLShop_OrderItem] I On I.OrderFormID=O.OrderFormID Where O.SalerID=",
				this.UserID,
				" and I.ID in(select max(ID) from HLShop_OrderItem Group by OrderFormID) ",
				this.wherestr,
				" Order By O.OrderFormID Desc"
			}), this.param);
		}
		int num = 0;
		if (Fetch.Get("pageindex") != null)
		{
			num = Convert.ToInt32(Fetch.GetID("pageindex").ToString());
			if (num == 0)
			{
				num = 1;
			}
		}
		if (dataTable != null)
		{
			int num2 = 3;
			int count = dataTable.Rows.Count;
			DataTable pagedTable = CurrPageLinks.instance.GetPagedTable(dataTable, num, num2);
			this.DataTablePage(pagedTable);
			string url = this.beforeurl + this.linkHead + "&pageindex";
			this.ltrPagePanel.Text = CurrPageLinks.instance.CurrPageLinkStr(num, num2, count, "条记录&nbsp;每页" + num2 + "条记录&nbsp;", url, true);
		}
		this.ButonShowHide();
	}
	private void DataTablePage(DataTable dt)
	{
		if (dt != null)
		{
			this.rptOrderInfo.DataSource = dt;
			this.rptOrderInfo.DataBind();
			for (int i = 0; i < this.rptOrderInfo.Items.Count; i++)
			{
				HiddenField hiddenField = (HiddenField)this.rptOrderInfo.Items[i].FindControl("hfOrderFormID");
				HiddenField hiddenField2 = (HiddenField)this.rptOrderInfo.Items[i].FindControl("hfOrderFormNum");
				if (hiddenField != null)
				{
					if (!string.IsNullOrEmpty(hiddenField.Value))
					{
						string sql = "select (select COUNT(HLShop_OrderItem.OrderFormID) from HLShop_OrderItem where HLShop_OrderItem.OrderFormID=item.OrderFormID) as ItemCount\r\n        ,o.Status,o.DeliverStatus,o.PayStatus,\r\n        product.ProductImageUrl,product.ProductSmallImageUrl,item.* \r\n        from HLShop_Order as o,HLShop_OrderItem as item,HLShop_Product as product \r\n        where o.OrderFormID=item.OrderFormID and product.ProductID=item.ProductID and item.OrderFormID in (" + hiddenField.Value + ")";
						DataTable dataTable = this.conn.GetDataTable(sql);
						Repeater repeater = (Repeater)this.rptOrderInfo.Items[i].FindControl("rptOrderItem");
						if (repeater != null)
						{
							repeater.DataSource = dataTable;
							repeater.DataBind();
							for (int j = 0; j < repeater.Items.Count; j++)
							{
								HiddenField hiddenField3 = (HiddenField)repeater.Items[j].FindControl("hfitemCount");
								Panel panel = (Panel)repeater.Items[j].FindControl("pnlRowspan");
								if (hiddenField3 != null)
								{
									if (!string.IsNullOrEmpty(hiddenField3.Value))
									{
										if (j == 0)
										{
											if (panel != null)
											{
												panel.Visible = true;
											}
										}
										else
										{
											if (panel != null)
											{
												panel.Visible = false;
											}
										}
									}
									else
									{
										if (panel != null)
										{
											panel.Visible = false;
										}
									}
								}
							}
						}
					}
				}
			}
		}
	}
	private void ButonShowHide()
	{
		for (int i = 0; i < this.rptOrderInfo.Items.Count; i++)
		{
			Repeater repeater = (Repeater)this.rptOrderInfo.Items[i].FindControl("rptOrderItem");
			HiddenField hiddenField = (HiddenField)this.rptOrderInfo.Items[i].FindControl("hfTradeTypeID");
			if (repeater != null)
			{
				for (int j = 0; j < repeater.Items.Count; j++)
				{
					RepeaterItem repeaterItem = repeater.Items[j];
					HiddenField hiddenField2 = (HiddenField)repeaterItem.FindControl("hfPoductID");
					HiddenField hiddenField3 = (HiddenField)repeaterItem.FindControl("hfOldPrice");
					HiddenField hiddenField4 = (HiddenField)repeaterItem.FindControl("hfNeedPresentExp");
					Literal literal = (Literal)repeaterItem.FindControl("ltr_OldPrice");
					Literal literal2 = (Literal)repeaterItem.FindControl("ltr_PriceOrScore");
					if (hiddenField != null)
					{
						if (hiddenField.Value.Trim() == "5")
						{
							if (hiddenField4 != null)
							{
								if (literal2 != null)
								{
									literal2.Text = "换购积分：" + hiddenField4.Value;
								}
							}
						}
					}
					HyperLink hyperLink = (HyperLink)repeaterItem.FindControl("hlStatus");
					HiddenField hiddenField5 = (HiddenField)repeaterItem.FindControl("hfOrderStatus");
					Button button = (Button)repeaterItem.FindControl("btnOrderStatus");
					HyperLink hyperLink2 = (HyperLink)repeaterItem.FindControl("hlDeliverStatus");
					HiddenField hiddenField6 = (HiddenField)repeaterItem.FindControl("hfDeliverStatus");
					Button button2 = (Button)repeaterItem.FindControl("btnDeliverStatus");
					Button button3 = (Button)repeaterItem.FindControl("BtnAgreedReturn");
					HiddenField hiddenField7 = (HiddenField)repeaterItem.FindControl("hfPayStatus");
					Button button4 = (Button)repeaterItem.FindControl("btnDelOrder");
					Label label = (Label)repeaterItem.FindControl("lblComment");
					if (hiddenField5 != null)
					{
						if (hiddenField5.Value.Trim() == "0")
						{
							hyperLink2.Enabled = false;
							if (button != null)
							{
								button.Visible = true;
							}
							if (button2 != null)
							{
								button2.Visible = false;
							}
							if (label != null)
							{
								label.Visible = false;
							}
						}
						else
						{
							if (hiddenField5.Value.Trim() == "1")
							{
								if (button != null)
								{
									button.Visible = false;
								}
								if (label != null)
								{
									label.Visible = false;
								}
							}
							else
							{
								if (hiddenField5.Value.Trim() == "2")
								{
									if (button != null)
									{
										button.Visible = false;
									}
									if (label != null)
									{
										label.Visible = true;
									}
								}
								else
								{
									if (button != null)
									{
										button.Visible = false;
									}
									hyperLink2.Enabled = false;
									if (label != null)
									{
										label.Visible = false;
									}
								}
							}
						}
					}
					if (hiddenField7 != null)
					{
						if (hiddenField7.Value.Trim() == "0")
						{
							if (button4 != null)
							{
								button4.Visible = true;
							}
						}
						else
						{
							if (button4 != null)
							{
								button4.Visible = false;
							}
						}
					}
					if (hiddenField6.Value == "0")
					{
						hyperLink2.Enabled = true;
						if (button2 != null)
						{
							button2.Visible = true;
							if (hiddenField5 != null)
							{
								if (hiddenField5.Value.Trim() == "0")
								{
									button2.Visible = false;
								}
							}
						}
						if (button3 != null)
						{
							button3.Visible = false;
						}
					}
					else
					{
						if (hiddenField6.Value == "1")
						{
							hyperLink2.Enabled = false;
							if (button2 != null)
							{
								button2.Visible = false;
							}
						}
						else
						{
							if (hiddenField6.Value == "2")
							{
								if (button3 != null)
								{
									button3.Visible = false;
								}
							}
							else
							{
								if (hiddenField6.Value == "-1")
								{
									if (button3 != null)
									{
										button3.Visible = true;
									}
								}
							}
						}
					}
				}
			}
		}
	}
	protected void Button_Command(object sender, CommandEventArgs e)
	{
		string commandName = e.CommandName;
		string text = e.CommandArgument.ToString();
		if (commandName == "DelOrder")
		{
			if (!string.IsNullOrEmpty(text))
			{
				bool flag = false;
				int num = Convert.ToInt32(text);
				if (this.JustDelOrderFormNum(num))
				{
					this.conn.BeginTransaction();
					try
					{
						string commandText = "Delete from HLJXC_StockInfoOrder where OrderID=" + num;
						string commandText2 = "Delete from HLJXC_StockItemOrder where InfoOrderID in (select InfoOrderID from HLJXC_StockInfoOrder where OrderID=" + num + ")";
						string commandText3 = "Delete From [HLShop_Order] Where OrderFormID=" + num;
						string commandText4 = "Delete From [HLShop_OrderItem] Where OrderFormID=" + num;
						this.conn.ExecuteTransaction(commandText2);
						this.conn.ExecuteTransaction(commandText);
						this.conn.ExecuteTransaction(commandText4);
						this.conn.ExecuteTransaction(commandText3);
					}
					catch
					{
						this.conn.Rollback();
						flag = false;
					}
					finally
					{
						this.conn.Commit();
						flag = true;
					}
				}
				if (flag)
				{
					this.WriteSuccessMsg("", "删除成功！", "");
				}
			}
		}
		else
		{
			if (commandName == "AgreedReturn")
			{
				if (!string.IsNullOrEmpty(text))
				{
					int num = text.ToInt32(new int[0]);
					if (num > 0)
					{
						string sql = "select * from HLShop_Order where OrderFormID=" + num;
						DataTable dataTable = this.conn.GetDataTable(sql);
						if (dataTable != null)
						{
							if (dataTable.Rows.Count > 0)
							{
								string a = dataTable.Rows[0]["TradeType"].ToString();
								string text2 = dataTable.Rows[0]["OrderFormNum"].ToString();
								int userID = dataTable.Rows[0]["UserID"].ToInt32(new int[0]);
								string buyerName = dataTable.Rows[0]["BuyerName"].ToString();
								int userID2 = dataTable.Rows[0]["SalerID"].ToInt32(new int[0]);
								string salerName = dataTable.Rows[0]["SalerName"].ToString();
								string inputTime = dataTable.Rows[0]["InputTime"].ToString();
								if (a == "5")
								{
									if (dataTable.Rows[0]["PresentExpTotal"] != DBNull.Value)
									{
										string value = dataTable.Rows[0]["PresentExpTotal"].ToString();
										int num2 = Convert.ToInt32(value);
										if (num2 > 0)
										{
											UserExpAction userExpAction = new UserExpAction(this.conn);
											userExpAction.AddUserExpSql(userID, (long)num2, 1, "订单编号" + text2 + "退货商品的积分", "+");
											userExpAction.AddUserExpSql(userID2, (long)num2, 0, "订单编号" + text2 + "退货商品的积分", "-");
										}
									}
								}
								OrderAction orderAction = new OrderAction(this.conn);
								int num3 = -100;
								if (dataTable.Columns.Contains("SelectedPayType"))
								{
									if (dataTable.Rows[0]["SelectedPayType"] != DBNull.Value)
									{
										num3 = Convert.ToInt32(dataTable.Rows[0]["SelectedPayType"].ToString());
									}
								}
								bool flag2 = false;
								if (num3 == 0)
								{
									flag2 = orderAction.ShopBankReturnOrder(num);
								}
								if (flag2)
								{
									this.ReturnGoodsNotice(buyerName, salerName, text2, inputTime);
								}
							}
						}
					}
				}
			}
		}
	}
	private void ReturnGoodsNotice(string m_BuyerName, string m_SalerName, string OrderFormNum, string InputTime)
	{
		string title = "同意退货通知";
		string text = this.config["AgreeReturnGoods"].ToString();
		text = text.Replace("{$UserName$}", m_BuyerName);
		text = text.Replace("{$InputTime$}", InputTime);
		text = text.Replace("{$OrderFormNum$}", OrderFormNum);
		MessageBll messageBll = new MessageBll(this.conn);
		if (messageBll.AddMessage(m_SalerName, "Users", title, text, 0, 0, 1, 0, m_BuyerName, "", 1))
		{
			string msg = "操作成功！<br>" + Language.GetMemberMsg("Order/Notice/MessageSuccess", new string[0]);
			this.WriteSuccessMsg("", msg, "Shop_BuyOrder.aspx?OrderFormNum=" + OrderFormNum);
		}
	}
	protected void QuestString()
	{
		this.wherestr = "and ((O.TradeType=2 and DateDiff(s,UpdateTime,getdate())>=0 and (AuctionEndPrice in(select max(AuctionEndPrice) from HLShop_Order as a,HLShop_OrderItem as b where a.OrderFormID=b.OrderFormID Group by b.ProductID))) or (O.TradeType=3 and O.Teameffect=1) or (O.TradeType<>2 and O.TradeType<>3)) " + this.ProTypeWhere;
		if (base.ShowProType == "5")
		{
			this.beforeurl += "&showProType=5";
		}
		string text = Fetch.Get("OrderFormNum");
		if (!string.IsNullOrEmpty(text))
		{
			this.TxtOrderNum.Text = text;
		}
		else
		{
			text = this.TxtOrderNum.Text.Trim();
		}
		if (!string.IsNullOrEmpty(text))
		{
			this.wherestr = this.wherestr + "and O.OrderFormNum like '%" + text.Trim() + "%' ";
			this.linkHead = this.linkHead + "&OrderFormNum=" + text.Trim();
		}
		string text2 = Fetch.Get("BuyerName");
		if (!string.IsNullOrEmpty(text2))
		{
			this.TxtCusName.Text = text2;
		}
		else
		{
			text2 = this.TxtCusName.Text.Trim();
		}
		if (!string.IsNullOrEmpty(text2))
		{
			this.wherestr = this.wherestr + "and O.BuyerName like '%" + text2.Trim() + "%' ";
			this.linkHead = this.linkHead + "&BuyerName=" + text2.Trim();
		}
		string text3 = Fetch.Get("productname");
		if (!string.IsNullOrEmpty(text3))
		{
			this.TxtProductName.Text = text3;
		}
		else
		{
			text3 = this.TxtProductName.Text.Trim();
		}
		if (!string.IsNullOrEmpty(text3))
		{
			this.wherestr = this.wherestr + "and I.ProductName like '%" + text3.Trim() + "%' ";
			this.linkHead = this.linkHead + "&productname=" + text3.Trim();
		}
		string text4 = Fetch.Get("BeginDate");
		if (!string.IsNullOrEmpty(text4))
		{
			this.TxtBeginDate.Text = text4;
		}
		else
		{
			text4 = this.TxtBeginDate.Text.Trim();
		}
		if (!string.IsNullOrEmpty(text4))
		{
			if (!Text.IsDate(text4))
			{
				this.WriteErrMsg("", Language.Get("Common/DateTimeFormatErr"), "");
			}
			this.wherestr = this.wherestr + "and DateDiff(dd,O.UpdateTime, '" + text4 + "')<=0 ";
			this.linkHead = this.linkHead + "&BeginDate=" + text4;
		}
		string text5 = Fetch.Get("EndDate");
		if (!string.IsNullOrEmpty(text5))
		{
			this.TxtEndDate.Text = text5;
		}
		else
		{
			text5 = this.TxtEndDate.Text.Trim();
		}
		if (!string.IsNullOrEmpty(text5))
		{
			if (!Text.IsDate(text5))
			{
				this.WriteErrMsg("", Language.Get("Common/DateTimeFormatErr"), "");
			}
			if (text4 != string.Empty)
			{
				if (Convert.ToDateTime(text4) > Convert.ToDateTime(text5))
				{
					this.WriteErrMsg("", Language.Get("Common/DateTimeErr"), "");
				}
			}
			this.wherestr = this.wherestr + "and DateDiff(dd,O.UpdateTime, '" + text5 + "')>=0 ";
			this.linkHead = this.linkHead + "&EndDate=" + text5;
		}
		string text6 = Fetch.Get("BeginMoney");
		if (!string.IsNullOrEmpty(text6))
		{
			this.TxtBeginMoney.Text = text6;
		}
		else
		{
			text6 = this.TxtBeginMoney.Text.Trim();
		}
		if (!string.IsNullOrEmpty(text6))
		{
			if (!Text.IsNumber(text6.Trim()))
			{
				this.WriteErrMsg("", Language.Get("Common/NotNumber"), "");
			}
			this.wherestr = this.wherestr + "and O.MoneyTotal>=" + text6.Trim() + " ";
			this.linkHead = this.linkHead + "&BeginMoney=" + text6.Trim();
		}
		string text7 = Fetch.Get("EndMoney");
		if (!string.IsNullOrEmpty(text7))
		{
			this.TxtEndMoney.Text = text7;
		}
		else
		{
			text7 = this.TxtEndMoney.Text.Trim();
		}
		if (!string.IsNullOrEmpty(text7))
		{
			if (!Text.IsNumber(text7.Trim()))
			{
				this.WriteErrMsg("", Language.Get("Common/NotNumber"), "");
			}
			this.wherestr = this.wherestr + "and O.MoneyTotal<=" + text7.Trim() + " ";
			this.linkHead = this.linkHead + "&EndMoney=" + text7.Trim();
		}
		string text8 = Fetch.Get("OrderStaticSel");
		if (!string.IsNullOrEmpty(text8))
		{
			this.DroOrderStatic.ddlSelect(text8);
		}
		else
		{
			text8 = this.DroOrderStatic.SelectedValue.Trim();
		}
		if (!string.IsNullOrEmpty(text8))
		{
			string text9 = text8;
			if (text9 != null)
			{
				if (!(text9 == "0"))
				{
					if (!(text9 == "1"))
					{
						if (!(text9 == "2"))
						{
							if (!(text9 == "4"))
							{
								if (!(text9 == "5"))
								{
									if (text9 == "6")
									{
										object obj = this.wherestr;
										this.wherestr = string.Concat(new object[]
										{
											obj,
											"and O.Status=2 and O.OrderFormNum in (select OrderFormNum from HLMall_Credit where ValuerID=",
											base.user.UserID,
											") "
										});
									}
								}
								else
								{
									object obj = this.wherestr;
									this.wherestr = string.Concat(new object[]
									{
										obj,
										"and O.Status=2 and O.OrderFormNum not in (select OrderFormNum from HLMall_Credit where ValuerID=",
										base.user.UserID,
										") "
									});
								}
							}
							else
							{
								this.wherestr += "and O.Status=4 ";
							}
						}
						else
						{
							this.wherestr += "and O.Status=2 ";
						}
					}
					else
					{
						this.wherestr += "and O.Status=1 ";
					}
				}
				else
				{
					this.wherestr += "and O.TradeType<>2 and O.TradeType<>3 and O.Status=0 ";
				}
			}
			this.linkHead = this.linkHead + "&OrderStaticSel=" + text8;
		}
		string text10 = Fetch.Get("PayStaticSel");
		if (!string.IsNullOrEmpty(text10))
		{
			this.DroPayStatic.ddlSelect(text10);
		}
		else
		{
			text10 = this.DroPayStatic.SelectedValue.Trim();
		}
		if (!string.IsNullOrEmpty(text10))
		{
			string text9 = text10;
			if (text9 != null)
			{
				if (!(text9 == "0"))
				{
					if (!(text9 == "1"))
					{
						if (text9 == "2")
						{
							this.wherestr += "and O.PayStatus=2  ";
						}
					}
					else
					{
						this.wherestr += "and O.PayStatus=1 ";
					}
				}
				else
				{
					this.wherestr += "and O.PayStatus=0 ";
				}
			}
			this.linkHead = this.linkHead + "&PayStaticSel=" + text10;
		}
		string text11 = Fetch.Get("DeliverStatusSel");
		if (!string.IsNullOrEmpty(text11))
		{
			this.DropDeliverStatus.ddlSelect(text11);
		}
		else
		{
			text11 = this.DropDeliverStatus.SelectedValue.Trim();
		}
		if (!string.IsNullOrEmpty(text11))
		{
			string text9 = text11;
			if (text9 != null)
			{
				if (!(text9 == "0"))
				{
					if (!(text9 == "1"))
					{
						if (!(text9 == "2"))
						{
							if (!(text9 == "-1"))
							{
								if (text9 == "-2")
								{
									this.wherestr += "and DeliverStatus=-2 ";
								}
							}
							else
							{
								this.wherestr += "and DeliverStatus=-1 ";
							}
						}
						else
						{
							this.wherestr += "and O.DeliverStatus=2 ";
						}
					}
					else
					{
						this.wherestr += "and O.DeliverStatus=1 ";
					}
				}
				else
				{
					this.wherestr += "and O.DeliverStatus=0 ";
				}
			}
			this.linkHead = this.linkHead + "&DeliverStatusSel=" + text11;
		}
		string text12 = Fetch.Get("MomentSel");
		if (!string.IsNullOrEmpty(text12))
		{
			this.DropMoment.ddlSelect(text12);
		}
		else
		{
			text12 = this.DropMoment.SelectedValue.Trim();
		}
		if (!string.IsNullOrEmpty(text12))
		{
			string text9 = text12;
			if (text9 != null)
			{
				if (!(text9 == "1"))
				{
					if (!(text9 == "3"))
					{
						if (!(text9 == "10"))
						{
							if (text9 == "30")
							{
								this.wherestr += "and DateDiff(mm,O.InputTime, getdate())=0 ";
							}
						}
						else
						{
							this.wherestr += "and DateDiff(dd,O.InputTime, getdate())<=10 ";
						}
					}
					else
					{
						this.wherestr += "and DateDiff(dd,O.InputTime, getdate())<=3 ";
					}
				}
				else
				{
					this.wherestr += "and DateDiff(dd,O.InputTime, getdate())=0 ";
				}
			}
			this.linkHead = this.linkHead + "&MomentSel=" + text12;
		}
	}
	protected void search(object sender, EventArgs e)
	{
		this.BindList();
	}
	protected bool JustDelOrderFormNum(int OrderID)
	{
		DataSet dataSet = this.conn.GetDataSet("select * from HLShop_Order where OrderFormID=" + OrderID);
		return dataSet != null && dataSet.Tables[0].Rows.Count > 0 && !(dataSet.ToString() == "") && (dataSet.Tables[0].Rows[0]["PayStatus"].ToString() == "0" || int.Parse(dataSet.Tables[0].Rows[0]["Status"].ToString()) <= 0);
	}
	public string StrCommentStatus(string _OrderNum)
	{
		string text = "";
		DataTable dataTable = this.conn.GetDataTable("select * from HLMall_Credit where OrderFormNum='" + _OrderNum + "'");
		DataRow[] array = dataTable.Select(" ValuerID=" + base.user.UserID);
		string result;
		if (dataTable.Rows.Count == 2)
		{
			text = "双方已互评";
			dataTable.Dispose();
			result = text;
		}
		else
		{
			if (dataTable.Rows.Count == 0)
			{
				text = "<input id='btnComment' type='button' onclick=\"javascript:window.location.href='CreditComment.aspx?OrderFormNum=" + _OrderNum + "&IsBuySaler=1'\" value='评价' />";
				dataTable.Dispose();
				result = text;
			}
			else
			{
				if (array.Length == 1 && dataTable.Rows.Count == 1)
				{
					text = "已评价<br/>对方未评价";
					dataTable.Dispose();
					result = text;
				}
				else
				{
					if (array.Length == 0 && dataTable.Rows.Count == 1)
					{
						text = "<input id='btnComment' type='button' onclick=\"javascript:window.location.href='CreditComment.aspx?OrderFormNum=" + _OrderNum + "&IsBuySaler=1'\" value='评价' /><br/>对方已评价";
						dataTable.Dispose();
						result = text;
					}
					else
					{
						result = text;
					}
				}
			}
		}
		return result;
	}
}
